# -*- coding: utf-8 -*-
"""
-------------------------------------------------
Project Name: luffcity study project
File Name: redistest.py
Author: kij
Create Date: 2021/3/21
-------------------------------------------------
"""
import redis


# 直接连接redis
conn = redis.Redis(host='127.0.0.1', port=6379, password='123123', encoding='utf-8')

# k1=abc (存活10s)
conn.set('k1', "abc", ex=10)

# 获取数据
value = conn.get('k1')
print(value) # 字节类型